<?php
	session_start();
	if(!isset($_SESSION['user'])){
		header("Location: admin_login.php");
		exit;
	}
	
	require_once 'init.php';
	require_once 'application/user_dao.php';
	$user = unserialize($_SESSION['user']);
?>
<html>
	<head>
		<title>longtailcap.com administrator</title>
		<link rel="stylesheet" type="text/css" href="resources/css/style.css" />
		<script type="text/javascript">
			function redirect(id){
				<!--
				var address = "section_edition.php?id=" + id;
				window.location = address;
				//-->
			}
		</script>
	</head>
	<body>
		<div class="main" style="text-align: center; padding: 5px; font-size: 10pt">
			<div style="text-align: right">
				<div style="float: right; padding-right: 10px">
					<a href="logout.php">logout</a>
				</div>
				<div style="float: right; padding-right: 10px"><?php echo $user->getNameUser(); ?></div>
				<div style="clear: both"></div>
			</div>
			<h1>Site Administrator</h1>
			<?php
				$section_manager = new Section_manager($conn);
				$sections = $section_manager->getSectionsForAdministration();
				print_sections_resume($sections);
			?>
		</div>
	</body>
</html>